package com.yw.wanandroid.ui.adapter

import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter

class MainPagerAdapter(activity: AppCompatActivity, vararg fragments: Fragment) :
    FragmentStateAdapter(activity) {
    private val datas = mutableListOf<Fragment>()

    init {
        fragments.forEach {
            datas.add(it)
        }
    }

    override fun getItemCount(): Int {
        return datas.size
    }

    override fun createFragment(position: Int): Fragment {
        return datas[position]
    }

}
